Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.6.22
|
Leadtools.Barcode Namespace > BarcodeReader Class > ReadBarcode Method : ReadBarcode(RasterImage,LeadRect,BarcodeSymbology[]) Method |
public BarcodeData ReadBarcode( RasterImage image, LeadRect searchBounds, BarcodeSymbology[] symbologies )
'Declaration
Public Overloads Function ReadBarcode( _ ByVal image As RasterImage, _ ByVal searchBounds As LeadRect, _ ByVal symbologies() As BarcodeSymbology _ ) As BarcodeData
'Usage
Dim instance As BarcodeReader Dim image As RasterImage Dim searchBounds As LeadRect Dim symbologies() As BarcodeSymbology Dim value As BarcodeData value = instance.ReadBarcode(image, searchBounds, symbologies)
public BarcodeData ReadBarcode( RasterImage image, LeadRect searchBounds, BarcodeSymbology[] symbologies )
function Leadtools.Barcode.BarcodeReader.ReadBarcode(RasterImage,LeadRect,BarcodeSymbology[])( image , searchBounds , symbologies )
public: BarcodeData^ ReadBarcode( RasterImage^ image, LeadRect searchBounds, array<BarcodeSymbology>^ symbologies )
Note: In LEADTOOLS for .NET, the equivalent to LeadRect is LogicalRectangle.
This example shows how to use this method to read any UPC barcode used to identify products from an image.
using Leadtools; using Leadtools.Codecs; using Leadtools.Barcode; using Leadtools.ImageProcessing; public async Task BarcodeReader_ReadBarcodeExample3() { string imageFileName = @"Assets\Barcode1.tif"; // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Get the Barcode reader instance BarcodeReader reader = engine.Reader; using(RasterCodecs codecs = new RasterCodecs()) { StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(imageFileName); using(RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile))) { // In the US, UPC barcodes are used to identity products. So, create an array of UPC symbologies BarcodeSymbology[] upcSymbologies = { BarcodeSymbology.UPCA, BarcodeSymbology.UPCE }; // Read the first UPC barcode from the image BarcodeData barcode = reader.ReadBarcode(image, LeadRectHelper.Empty, upcSymbologies); // Show its location and data if found if(barcode != null) { Debug.WriteLine("Found a {0} barcode at {1}, data:\n{2}", barcode.Symbology, barcode.Bounds, barcode.Value); } else { Debug.WriteLine("Not found"); } } } }